package com.lhn;

import com.lhn.service.BookService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author lhn
 * @date 2024-08-15 16:26
 */

public class App2 {
    public static void main(String[] args) {
        // 创建IOC容器
        ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");

        // 获取bean，bookService是xml文件中的id
        BookService bookService = (BookService) ctx.getBean("bookService");
        System.out.println(bookService);
        bookService.save();
    }
}
